/**
 * Created by zhangjian37 on 2016/11/19.
 */
var photos_array = new Array();
var div_id_str = "";
var time_long = 1000;
var index_int = 0;

var t;

function carousel(photos,div_id,time,index,window){
    photos_array = photos;
    div_id_str = div_id;
    time_long = time;
    index_int = index;

    carousel1()
}

function carousel1(){
    var photos_len = photos_array.length;
    var content_html = '';
    for (var i = 0; i < photos_len; i++){
        if(i==index_int) {
            content_html += '<a href="javascript:void(0)" style="margin-left:-500px;z-index: ' + (photos_len - i) + ';display:block;"><img src="' + photos_array[i] + '"></a>';
        }else{
            content_html += '<a href="javascript:void(0)" style="margin-left:-500px;z-index: ' + (photos_len - i) + ';display:none;"><img src="' + photos_array[i] + '"></a>';
        }
    }

    content_html += '<div class="carousel_point">';
    for (var i = 0; i < photos_len; i++){
        if(i==index_int) {
            content_html += '<a href="javascript:carousel_point('+i+')" class="hover">'+i+'</a>';
        }else{
            content_html += '<a href="javascript:carousel_point('+i+')">'+i+'</a>';
        }
    }
    content_html +="</div>"

    document.getElementById(div_id_str).innerHTML = content_html;

    index_int++;
    if(index_int>=photos_len)index_int = 0;

    t = setTimeout("carousel1()",3000);
}

function carousel_point(i){
    clearTimeout(t);
    index_int = i;
    carousel(photos_array,div_id_str,time_long,index_int);
}

//通过数据量，一行显示量，底部元素，控制显示样式
function control_footer_css(content_size,line_size,foot){

}
